<script src="__PUBLIC__/js/jquery.datePicker-min.js" type="text/javascript"></script>
<link href="__PUBLIC__/js/datePicker.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="__ROOT__/Public/js/FCKeditor/fckeditor.js"></script>
<script language="JavaScript" type="text/javascript">
$(document).ready(function(){
	$("#typeid").change(function(){
		var id=this.value;
		id=id.split('_');
		var cache=$("#cache").html();
		id="#channel_"+id['0'];
		if(id!=cache){
			$("#channel").html($(id).html());
			$("#cache").html(id);
		}
		//alert(id);
	});
	$('.showend_job').datePicker({clickInput:true});
});
function zone(obj,id,name){
	if(name==0){
		var cid=obj.options[obj.options.selectedIndex].value;
	}else{
		var cid=obj.options[obj.options.selectedIndex].className;
	}
	$(id).load(URL+'/ajax_zone',{cid:cid,types:'localion',name:name});
}
</script>
<div class="mulu">
	<a href="__APP__/">Home</a> > <a href="__APP__/Cp/index">Control Panel</a> > 
	<a href="__APP__/Cp/my_cityguide_post">My CityGuide</a>
</div>
<div class="right-neirong">
    <div class="clear">
    </div>
    <div class="right-messages">
        <div class="right-title">
            <h3 style="margin:0;">Post CityGuide</h3>
        </div>
        <div class="list">
            <form action="__URL__/add_cityguide" method="post" enctype="multipart/form-data">
            	<if condition="$data['id']"><input type="hidden" name="id" value="{$data['id']}"></if>
            	<fieldset>
				<legend>Basic Elements:</legend>
				<div style="width:500px;float:left;">
	            	<p>
	            		<label for="title">Title:</label><input type="text" name="title" id="title" value="{$data['title']}" style="width:300px;">
					</p>
					<p><label for="showend_job">Valid for</label>
						<input type="text" name="showstart" id="showend_job" class="showend_job" value="{$data['showstart']|toDate='d/m/Y'}" style="width:80px;">
						---> <input type="text" name="showend" id="showend_job" class="showend_job" value="{$data['showend']|toDate='d/m/Y'}" style="width:80px;">
					</p>
					<p>
						<label for="cid">Post to</label>
						<select name="cid" id="cid">
							<option>--Favorite City--</option>
                            <option value="0"<php>selected(0,$data['cid']);</php>>All</option>
							<volist name="citylist" id="v">
								<option value="{$v['id']}"{$v['id']|selected=$data['cid']}>{$v['ctitle']}</option>
							</volist>
						</select>
					</p>
					<p>
						<label for="position">Localtion:</label>
						<select name="city_id" class="city_id" onchange="zone(this,'.zone_id',0)">
							<option value="0">Select City</option>
							<volist name="citylist" id="v">
							<option value="{$v['id']}"{$v['id']|selected=$data['city_id']}>{$v['ctitle']}</option>
							</volist>
						</select>
						<select name="zone_id" class="zone_id">
							<option value="0">Select District</option>
							<volist name="citylist[$data['city_id']]['_zone']" id="v">
								<option value="{$v['id']}"{$v['id']|selected=$data['zone_id']}>{$v['name']}</option>
							</volist>
						</select>
						<input type="text" name="position" id="position" value="{$data['position']}" style=" width:150px;">
					</p>
					<p>
						<label for="contact">Chinese address:</label>
						<input type="text" name="contact" id="contact" value="{$data['contact']}" class="w320"><br>
						The Google map is shown according to the Chinese address. <br>
					</p>
                    
                    <p>
						<label for="keywords">Tags:</label>
						<input type="text" name="keywords" id="keywords" value="{$data['keywords']}" class="w320"><br>
                        Please separate tags with ",".
					</p>
					<if condition="$data['maps']">
					<p>
						<label for="maps">Maps:</label>{$data['maps']}<br>
					</p>
					</if>
					</div>
					<div style="width:180px; float:left;">
					<if condition="$data['picurl']">
						<img src="{$data['picurl']|picurl}" id="picurl_img" width="120">	
					</if>
					</div>
				</fieldset>

				<fieldset>
				<legend>Select Section:</legend>
					<p>
						<label for="typeid">Section:</label>
						<select id="typeid" name="typeid">
							<option value="0">---Select Main Category---</option>
							<volist name="class_tree" id="v">
                            	<if condition="$cat">
                                	<if condition="$cat==$v['id']">
                                    	<option value="{$v['channeltype']}_{$v['id']}"{$v['id']|selected=$data['typeid']}>+{$v['typename']}</option>
                                        <volist name="v['_son']" id="vs">
                                        <option value="{$v['channeltype']}_{$vs['id']}"{$vs['id']|selected=$data['typeid']}>+---{$vs['typename']}</option>
                                        <volist name="vs['_son']" id="vss">
                                            <option value="{$v['channeltype']}_{$vss['id']}"{$vss['id']|string2checked=$data['typeid2'],',','selected'}>+---+---{$vss['typename']}</option>
                                        </volist>
                                    </volist>
                                    <else/>
                                    	<volist name="v['_son']" id="vs">
                                        <if condition="$cat==$vs['id']">
                                        <option value="{$v['channeltype']}_{$vs['id']}"{$vs['id']|selected=$data['typeid']}>+---{$vs['typename']}</option>
                                        <volist name="vs['_son']" id="vss">
                                            <option value="{$v['channeltype']}_{$vss['id']}"{$vss['id']|string2checked=$data['typeid2'],',','selected'}>+---+---{$vss['typename']}</option>
                                        </volist>
                                        </if>
                                    </volist>
                                    </if>
                                <else/>
								<option value="{$v['channeltype']}_{$v['id']}"{$v['id']|selected=$data['typeid']}>+{$v['typename']}</option>
								<volist name="v['_son']" id="vs">
									<option value="{$v['channeltype']}_{$vs['id']}"{$vs['id']|selected=$data['typeid']}>+---{$vs['typename']}</option>
									<volist name="vs['_son']" id="vss">
										<option value="{$v['channeltype']}_{$vss['id']}"{$vss['id']|string2checked=$data['typeid2'],',','selected'}>+---+---{$vss['typename']}</option>
									</volist>
								</volist>
                                </if>
							</volist>
						</select>
					</p>

				</fieldset>
				<fieldset>
				<legend>About</legend>
					<p>
						<label for="my_content">Description:</label>
						<textarea name="my_content" cols="90" rows="8" style="font-size:12px;">{$data['my_content']|br2nl}</textarea>
					</p>
					<p>
						<label for="content">Content:</label>
						<!-- 编辑器调用开始 -->
						<textarea id="editor_editor" name="content">{$addon['content']}</textarea>
						<script type="text/javascript">
						var id="editor_editor";
						var oFCKeditor = new FCKeditor(id,"100%","445px" );
						oFCKeditor.BasePath = "__ROOT__/Public/js/FCKeditor/";
						oFCKeditor.ReplaceTextarea();
						function resetEditor(){
							setContents(id,document.getElementById(id).value)
						};
						function saveEditor(){
							document.getElementById(id).value = getContents(id);
						}
						function InsertHTML(html){
							var oEditor = FCKeditorAPI.GetInstance(id);
							if (oEditor.EditMode == FCK_EDITMODE_WYSIWYG ){
								oEditor.InsertHtml(html);
								}else
									alert( "WYSIWYG Model" );
						}</script>
						<!-- 编辑器调用结束 -->
					</p>
					
					<!--p><label for="telephone">telephone:</label>
						<input type="text" name="telephone" id="telephone" value="{$data['telephone']}">
					</p>
					<p><label for="fax">fax:</label>
						<input type="text" name="fax" id="fax" value="{$data['fax']}">
					</p>
					<p><label for="mobphone">mobphone:</label>
						<input type="text" name="mobphone" id="mobphone" value="{$data['mobphone']}">
					</p>
					<p><label for="email">email:</label>
						<input type="text" name="email" id="email" value="{$data['email']}">
					</p>
					<p><label for="msn">msn:</label>
						<input type="text" name="msn" id="msn" value="{$data['msn']}">
					</p>
					<p><label for="oicq">QQ:</label>
						<input type="text" name="oicq" id="oicq" value="{$data['oicq']}">
					</p-->
				</fieldset>
				<p align="center" >
					<input type="submit" value="Submit">    
					<input type="reset" value="Reset">
				</p>
				<span id="cache" style="display:none;"></span>
            </form>
        </div>
    </div>
</div>
<div class="clear"></div>

